﻿using System.Collections.Generic;
using System.Web.Mvc;
using NUnit.Framework;
using Safal.IncidentTracker.WebUI.HtmlHelpers;

namespace Safal.IncidentTracker.Tests
{
    [TestFixture]
    public class MenuTabs
    {
        [Test]
        public void Can_Create_Menu_Tab()
        {
            // Arrange
            HtmlHelper htmlHelper = UnitTestHelpers.GetHtmlHelper();
            var routeData = htmlHelper.ViewContext.RequestContext.RouteData;

            routeData.Values["controller"] = "Incidents";
            routeData.Values["action"] = "List";
            
            var menuTabs = new List<MenuTab>
                {
                    new MenuTab{ Text = "Home", Action = "List", Controller = "Incidents"},
                    new MenuTab{ Text = "Create incident", Action = "Create", Controller = "Incidents"} 
                };

            // Act
            MvcHtmlString result = htmlHelper.MenuTab(menuTabs);
            // Assert
            Assert.That(result.ToString(), Is.EqualTo(@"<ul><li class=""active""><a href=""/Incidents/List"">Home</a></li><li><a href=""/Incidents/Create"">Create incident</a></li></ul>"));
            
        }
    }

    
}
